

#include "common.h"

char* copystr(char* v){
    char* val = new char[strlen(v) + 1];
    strcpy(val, v);
    return val;

    // return v.c_str();
}

template <typename T>
void mergelist(T * list1, T * list2)
{
}

template <typename T>
void printlist(list<T> l){
    for(auto iter: l){
        cout<<(char*)iter->getvalue();
    }
}

void addtype(char *tag, char *type){
    printf("__table__ %s, %s \n", tag, type);
}

void *createvalue1(){
    return malloc(sizeof(value1));
}

TagNode *CreateTagNode(char *arg_tag){
    TagNode *tag = (TagNode*)calloc(1,sizeof(TagNode));
    tag->tag = arg_tag;
    return tag;
}

void InsertTag(TagNode* tag, char* tag_insert)
{
    TagNode* tmp = CreateTagNode(tag_insert);
    tag->next = tmp;
}

void ExtendTag(TagNode* tag, TagNode* tag2)
{
    tag->next = tag2;
}

void printNode(TagNode * tmp){
    TagNode *head = tmp;
    while(head){
        printf("%s->", head->tag);
        head = head->next;

    }
    printf("NULL\n");
}